USE [Training]
GO

IF NOT EXISTS (SELECT * from dbo.sysobjects WHERE id = OBJECT_ID(N'dbo.training_api_LocationSelect'))
	EXEC('CREATE PROC dbo.training_api_LocationSelect AS')
GO

ALTER PROC dbo.training_api_LocationSelect
	@LocationID	int = null
AS
	SELECT 
		LocationID,
		Title
	FROM Location
	WHERE
		(@LocationID IS NULL OR(LocationID = @LocationID))
